<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Grid 网格布局</title>
    <style>
        .container {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); /* 自适应列 */
            gap: 15px;
            padding: 20px;
        }
        .item {
            background: coral;
            padding: 20px;
            text-align: center;
            border-radius: 8px;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="item">1</div>
        <div class="item">2</div>
        <div class="item">3</div>
        <div class="item">4</div>
        <div class="item">5</div>
        <div class="item">6</div>
    </div>
</body>
</html>